home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SNNSV32.ZIP / SNNSv3.2 / kernel / sources / glob_typ.h < prev    next >
C/C++ Source or Header  |  1994-04-25  |  13KB  |  420 lines

  1. /*****************************************************************************
  2.   FILE           : glob_typ.h
  3.   SHORTNAME      : 
  4.   SNNS VERSION   : 3.2
  5.  
  6.   PURPOSE        : SNNS-Kernel: Global Datatypes and Constants
  7.   NOTES          : For User's Application Programs, User-Interface and Kernel
  8.  
  9.   AUTHOR         : Niels Mache
  10.   DATE           : 14.02.90 
  11.  
  12.   CHANGED BY     : Michael Vogt, Guenter Mamier, Sven Doering
  13.   IDENTIFICATION : @(#)glob_typ.h    1.21 4/7/94
  14.   SCCS VERSION   : 1.21
  15.   LAST CHANGE    : 4/7/94
  16.  
  17.              Copyright (c) 1990-1994  SNNS Group, IPVR, Univ. Stuttgart, FRG
  18.  
  19. ******************************************************************************/
  20. #ifndef KR_GLOBAL_TYPES
  21. #define KR_GLOBAL_TYPES
  22.  
  23. #ifdef ultrix
  24.    /* DEC's pseudo ansi C-compiler doesn't understand const  */
  25. #  define const
  26. #endif
  27.  
  28.  
  29. #ifndef __BORLANDC__
  30.  
  31. /*  define KERNEL3D to build a 3D-Version of the kernel
  32. */
  33.  
  34. #define KERNEL3D
  35.  
  36.  
  37. /*  define MASPAR_KERNEL to build the parallel MasPar Kernel
  38. */
  39. /*
  40. #define MASPAR_KERNEL
  41. */
  42.  
  43. #endif
  44.  
  45. #ifdef MASPAR_KERNEL
  46.  
  47. /*  define MASPAR_KERNEL_EMULATION to build a (sequentiel) kernel that simulates
  48.     the MasPar interface
  49. */
  50. /*
  51. #define  MASPAR_KERNEL_EMULATION
  52. */
  53.  
  54. /*
  55. #define  KERNEL_VERBOSE
  56. */
  57.  
  58. #endif
  59.  
  60.  
  61. /* ******************************************   */
  62.  
  63. #ifndef TRUE
  64. #define     TRUE    1
  65. #endif
  66. #ifndef FALSE
  67. #define     FALSE   0
  68. #endif
  69.  
  70. /*#################################################
  71.  
  72. GROUP: Public Constants
  73.  
  74. #################################################*/
  75.  
  76. /*  Kernel user interface error codes
  77. */
  78. #define  KRERR_NO_ERROR         0
  79. #define  KRERR_INSUFFICIENT_MEM -1
  80. #define  KRERR_UNIT_NO          -2
  81. #define  KRERR_OUTFUNC          -3
  82. #define  KRERR_ACTFUNC          -4
  83. #define  KRERR_SITEFUNC         -5
  84. #define  KRERR_CREATE_SITE      -6
  85. #define  KRERR_ALREADY_CONNECTED  -7
  86. #define  KRERR_CRITICAL_MALLOC  -8
  87. #define  KRERR_FTYPE_NAME       -9
  88. #define  KRERR_FTYPE_ENTRY      -10
  89. #define  KRERR_COPYMODE         -11
  90. #define  KRERR_NO_SITES         -12
  91. #define  KRERR_FROZEN           -13
  92. #define  KRERR_REDEF_SITE_NAME  -14
  93. #define  KRERR_UNDEF_SITE_NAME  -15
  94. #define  KRERR_NOT_3D           -16
  95. #define  KRERR_DUPLICATED_SITE  -17
  96. #define  KRERR_INUSE_SITE       -18
  97. #define  KRERR_FTYPE_SITE       -19
  98. #define  KRERR_FTYPE_SYMBOL     -20
  99. #define  KRERR_IO               -21
  100. #define  KRERR_SAVE_LINE_LEN    -22
  101. #define  KRERR_FEW_LAYERS       -23
  102. #define  KRERR_NO_UNITS         -24
  103. #define  KRERR_EOF              -25
  104. #define  KRERR_LINE_LENGTH      -26
  105. #define  KRERR_FILE_FORMAT      -27
  106. #define  KRERR_FILE_OPEN        -28
  107. #define  KRERR_FILE_SYNTAX      -29
  108. #define  KRERR_MALLOC1          -30
  109. #define  KRERR_TTYPE            -31
  110. #define  KRERR_SYMBOL           -32
  111. #define  KRERR_NO_SUCH_SITE     -33
  112. #define  KRERR_NO_HIDDEN_UNITS  -34
  113. #define  KRERR_CYCLES           -35
  114. #define  KRERR_DEAD_UNITS       -36
  115. #define  KRERR_INPUT_PATTERNS   -37
  116. #define  KRERR_OUTPUT_PATTERNS  -38
  117. #define  KRERR_CHANGED_I_UNITS  -39
  118. #define  KRERR_CHANGED_O_UNITS  -40
  119. #define  KRERR_NO_INPUT_UNITS   -41
  120. #define  KRERR_NO_OUTPUT_UNITS  -42
  121. #define  KRERR_NO_PATTERNS      -43
  122. #define  KRERR_INCORE_PATTERNS  -44
  123. #define  KRERR_PATTERN_NO       -45
  124. #define  KRERR_LEARNING_FUNC    -46
  125. #define  KRERR_PARAMETERS       -47
  126. #define  KRERR_UPDATE_FUNC      -48
  127. #define  KRERR_INIT_FUNC        -49
  128. #define  KRERR_DERIV_FUNC       -50
  129. #define  KRERR_I_UNITS_CONNECT    -51
  130. #define  KRERR_O_UNITS_CONNECT    -52
  131. #define  KRERR_TOPOMODE     -53
  132. #define  KRERR_LEARNING_SITES   -54
  133. #define  KRERR_SITES_NO_SUPPORT -55
  134. #define  KRERR_NO_MASPAR_KERNEL -56
  135. #define  KRERR_NOT_NEIGHBOUR_LAYER -57
  136. #define  KRERR_MUCH_LAYERS      -58
  137. #define  KRERR_NOT_FULLY_CONNECTED -59
  138. #define  KRERR_MODE_FF1_INVALID_OP -60
  139. #define  KRERR_NET_TRANSFORM    -61
  140. #define  KRERR_NO_CURRENT_LINK    -62
  141. #define  KRERR_NO_CURRENT_UNIT    -63
  142. #define  KRERR_UNIT_NO_INPUTS    -64
  143. #define  KRERR_TOPO_DEFINITION    -65
  144. #define  KRERR_BAD_CONNECTION   -66
  145. #define  KRERR_MASPAR_NO_RESPOND -67
  146. #define  KRERR_NOT_IMPEMENTED_YET -68
  147. #define  KRERR_NOT_PARALLEL_MODE  -69
  148. #define  KRERR_MASPAR_OUT_OF_PE_MEM -70
  149. #define  KRERR_MASPAR_COMMUNICATE -71
  150. #define  KRERR_MASPAR_OUT_OF_PE   -72
  151. #define  KRERR_MISSING_DEFAULT_FUNC  -73
  152. #define  KRERR_MASPAR_MULTI_OUT_FUNC -74
  153. #define  KRERR_MASPAR_MULTI_ACT_FUNC -75
  154. #define  KRERR_NET_DEPTH        -76
  155. #define  KRERR_NO_OF_UNITS_IN_LAYER         -77
  156. #define  KRERR_UNIT_MISSING                 -78
  157. #define  KRERR_UNDETERMINED_UNIT            -79
  158. #define  KRERR_ACT_FUNC                     -80
  159. #define  KRERR_OUT_FUNC                     -81
  160. #define  KRERR_SITE_FUNC                    -82
  161. #define  KRERR_UNEXPECTED_SITES             -83
  162. #define  KRERR_UNEXPECTED_DIRECT_INPUTS     -84
  163. #define  KRERR_SITE_MISSING                 -85
  164. #define  KRERR_UNEXPECTED_LINK              -86
  165. #define  KRERR_LINK_MISSING                 -87
  166. #define  KRERR_LINK_TO_WRONG_SITE           -88
  167. #define  KRERR_TOPOLOGY                     -89
  168. #define  KRERR_PARAM_BETA                   -90
  169. #define  KRERR_CC_ERROR1                    -91
  170. #define  KRERR_CC_ERROR2                    -92
  171. #define  KRERR_CC_ERROR3                    -93
  172. #define  KRERR_CC_ERROR4                    -94
  173. #define  KRERR_CC_ERROR5                    -95
  174. #define  KRERR_CC_ERROR6                    -96
  175. #define  KRERR_CC_ERROR7                    -97
  176. #define  KRERR_CC_ERROR8                    -98
  177. #define  KRERR_CC_ERROR9                    -99
  178. #define  KRERR_CC_ERROR10                  -100
  179. #define  KRERR_CC_ERROR11                  -101
  180. #define  DLVQ_ERROR1                       -102
  181. #define  DLVQ_ERROR2                       -103
  182. #define  DLVQ_ERROR3                       -104
  183. #define  DLVQ_ERROR4                       -105
  184. #define  DLVQ_ERROR5                       -106
  185. #define  KRERR_NP_NO_MORE_ENTRIES          -107
  186. #define  KRERR_NP_NO_SUCH_PATTERN_SET      -108
  187. #define  KRERR_NP_NO_CURRENT_PATTERN       -109
  188. #define  KRERR_NP_DIMENSION                -110
  189. #define  KRERR_NP_NO_SUCH_PATTERN          -111
  190. #define  KRERR_NP_NO_CURRENT_PATTERN_SET   -112
  191. #define  KRERR_NP_DOES_NOT_FIT             -113
  192. #define  KRERR_NP_NO_TRAIN_SCHEME          -114
  193. #define  KRERR_NP_NO_OUTPUT_PATTERN        -115
  194. #define  KRERR_NP_INCOMPATIBLE_NEW         -116
  195.  
  196. /*  Function types
  197. */
  198. #define  OUT_FUNC        1
  199. #define  ACT_FUNC        2
  200. #define  SITE_FUNC       3
  201. #define  LEARN_FUNC      4
  202. #define  UPDATE_FUNC     5
  203. #define  INIT_FUNC       6
  204. #define  ACT_DERIV_FUNC  7
  205. #define  JOG_WEIGHT_FUNC 8
  206. #define  DEFAULT_FUNC    0x0100
  207. #define  BENCH_FUNC      0x0200
  208.  
  209.  
  210.  
  211. /*   entry types for name table
  212. */
  213. #define  UNUSED_SYM         0
  214. #define  UNIT_SYM           1
  215. #define  SITE_SYM           2
  216. #define  FTYPE_UNIT_SYM     3
  217.  
  218.  
  219. /*  Copy Modes
  220. */
  221. #define  INPUTS_AND_OUTPUTS     1
  222. #define  ONLY_INPUTS            2
  223. #define  ONLY_OUTPUTS           3
  224. #define  ONLY_UNIT              4
  225.  
  226.  
  227. /*  Topological Unit Types
  228. */
  229. #define  UNKNOWN       0
  230. #define  INPUT         1
  231. #define  OUTPUT        2
  232. #define  HIDDEN        3
  233. #define  DUAL          4
  234. #define  SPECIAL       5
  235. #define  SPECIAL_I     6
  236. #define  SPECIAL_O     7
  237. #define  SPECIAL_H     8
  238. #define  SPECIAL_D     9
  239. #define  SPECIAL_X    10 /* Only used for toggle special flag */
  240. #define  N_SPECIAL_X  11 /* Only used for toggle special flag */
  241.  
  242. /*  Unit Input Types
  243. */
  244. #define  NO_INPUTS      0
  245. #define  SITES          1
  246. #define  DIRECT_LINKS   2
  247.  
  248. /*  Pattern update modes
  249. */
  250. #define  OUTPUT_NOTHING  1
  251. #define  OUTPUT_ACT      2
  252. #define  OUTPUT_OUT      3
  253.  
  254. /*  Maximum number of pattern sets
  255. */
  256. #define  NO_OF_PAT_SETS 5
  257.  
  258. /*  Maximum Dimensions of Pattern
  259. */
  260. #define MAX_NO_OF_VAR_I_DIM     2  /* maximum number of variable input       */
  261.                    /* dimensions                             */
  262. #define MAX_NO_OF_VAR_O_DIM     2  /* maximum number of variable             */
  263.                    /* output dimensions                      */
  264. #define MAX_NO_OF_VAR_DIM       2  /* maximum of MAX_NO_OF_VAR_I_DIM         */
  265.                    /* MAX_NO_OF_VAR_O_DIM                    */
  266.  
  267. /*  Maximum no. of learning parameters for learning functions
  268. */
  269. #define     NO_OF_LEARN_PARAMS    10
  270.  
  271. /*  Maximum no. of init parameters for initialization functions
  272. */
  273. #define     NO_OF_INIT_PARAMS   10
  274.  
  275.  
  276. #ifdef KERNEL3D
  277.  
  278. /*  Translation Table op's
  279. */
  280. #define     OP_TRANSTABLE_GET           1
  281. #define     OP_TRANSTABLE_SET           2
  282. #define     OP_TRANSTABLE_CLEAR         3
  283.  
  284. #endif
  285.  
  286. /*#################################################
  287.  
  288. GROUP: Global Var's
  289.  
  290. #################################################*/
  291.  
  292. /*  Kernel Interface Error Code
  293. */
  294. #ifndef SNNS_KERNEL
  295. extern int  KernelErrorCode;
  296. #endif
  297.  
  298. /*#################################################
  299.  
  300. GROUP: Global Datatypes
  301.  
  302. #################################################*/
  303.  
  304. typedef int     bool;
  305. typedef float   FlintType;
  306. typedef int     krui_err;
  307.  
  308. typedef struct 
  309. {
  310.     int number_of_pattern;     /* the number of pattern (pairs) in           */
  311.                                /* this set                                   */
  312.     bool output_present;       /* TRUE if output pattern present             */
  313.     bool fixed_fixsizes;       /* the fixsizes of all pattern are equal      */
  314.     int in_fixsize;            /* if fixed_fixsizes TRUE, fixsize of         */
  315.                                /* the input pattern, else -1                 */
  316.     int out_fixsize;           /* if fixed_fixsizes TRUE, fixsize of         */
  317.                                /* the output pattern, else -1                */
  318.     int in_number_of_dims;     /* number of variable input dimensions        */
  319.     int out_number_of_dims;    /* number of variable output dimensions       */
  320.     int in_max_dim_sizes[MAX_NO_OF_VAR_I_DIM];  /* maximum values of         */
  321.                                                 /* the input dimension       */
  322.     int out_max_dim_sizes[MAX_NO_OF_VAR_O_DIM]; /* maximum values of the     */
  323.                                                 /* output dimension          */
  324.     int in_min_dim_sizes[MAX_NO_OF_VAR_I_DIM];  /* minimum values of the     */
  325.                                                 /* input dimensions          */
  326.     int out_min_dim_sizes[MAX_NO_OF_VAR_O_DIM]; /* minimum values of the     */
  327.                                                 /* output dimensions         */
  328. } pattern_set_info;
  329.  
  330. typedef struct
  331. {
  332.     int input_dim;             /* number of variable input dimensions        */
  333.     int input_dim_sizes[MAX_NO_OF_VAR_I_DIM];  /* actual sizes of the input  */
  334.                                                /* dimensions                 */
  335.     int input_fixsize;         /* size of the fixed part of the in pattern   */
  336.                                /* or 0 if no input pattern present           */
  337.     float *input_pattern;      /* pointer to the input pattern data          */
  338.     char *input_info;          /* pointer to an optional info string         */
  339.     int output_dim;            /* number of variable output dimensions       */
  340.     int output_dim_sizes[MAX_NO_OF_VAR_O_DIM]; /* actual sizes of the output */
  341.                                                /* dimensions                 */
  342.     int output_fixsize;        /* size of the fixed part of the out pattern  */
  343.                                /* or 0 if no output pattern present          */
  344.     float *output_pattern;     /* pointer to the output pattern data         */
  345.     char *output_info;         /* pointer to an optional info string         */
  346. } pattern_descriptor;
  347.  
  348.  
  349. #ifdef __STDC__
  350. typedef double  FlintTypeParam;
  351. #else
  352. typedef float  FlintTypeParam;
  353. #endif
  354.  
  355.  
  356. #ifndef KERNEL3D
  357.  
  358. struct   PosType  {
  359.   short  x,
  360.      y;
  361. };
  362.  
  363. #else
  364.  
  365. /*#################################################
  366.  
  367. GROUP: 3D-Kernel Definitions
  368.  
  369. #################################################*/
  370.  
  371. #define HAVE_QSORT
  372.  
  373. struct   PosType  {
  374.   short  x,
  375.      y,
  376.      z;
  377. };
  378.  
  379. #endif
  380.  
  381. #define  NO_OF_UNIT_CENTER_POS  1
  382.  
  383. struct   PositionVector  {
  384.   float  x,
  385.      y,
  386.      z,
  387.      w;
  388. };
  389.  
  390.  
  391. /* List of Inversion Units */
  392. struct UnitList{
  393.     int             no;
  394.     FlintType       act;
  395.     FlintType       i_act;
  396.     FlintType       im_act;
  397.     struct PosType  gridPos;
  398.     struct UnitList *next;
  399.     struct UnitList *prev;
  400. };
  401.  
  402. /*#################################################
  403.  
  404. GROUP: Constants for the parallel kernel
  405.  
  406. #################################################*/
  407.  
  408. /*  Topologic network types
  409. */
  410. #define  NET_TYPE_GENERAL  0   /*  normal network presentation, no limitations  */
  411. #define  NET_TYPE_FF1      1   /*  feedforward net with limitations  */
  412.  
  413. /*  MasPar modes
  414. */
  415. #define  MASPAR_DISCONNECT  0
  416. #define  MASPAR_CONNECT  1
  417.  
  418.  
  419. #endif
  420.